/**
 * Created by Cake on 2017/6/8.
 */

$(function () {

    autoSize();
    $(window).resize(function () {
        autoSize();
    });

});

function autoSize() {
    var height = $('.contract-wrapper').height(),
        width = $('.contract-wrapper').width(),
        wWidth = $(window).width(),
        scale = wWidth  / width;

    $('.contract-section-box').css({
        height: height/4 + 'px'
    });

    $('.contract-wrapper').css({
        width: wWidth * 2 + 'px'
    });

    $('.contract-wrapper').css({
        transform: 'scale(0.5) translate(-'+ wWidth +'px, -50%)'
    });
}

var dom = document.getElementById('qrcode');

var qrcode = new QRCode(dom, {
    width : 150,
    height : 150
});


function makeCode () {
    var text = dom.getAttribute('text');

    if (text != '') {
        qrcode.makeCode(text);
    } else {
        dom.innerHtml('暂无二维码');
    }
}

makeCode();
